package com.rpp.es.dao;

import com.rpp.es.model.Position;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

public interface PositionRespository extends ElasticsearchRepository<Position, String> {

    @Query("{\"match\": {\"positionName\":\"?0\"}}")
    Page<Position> findByPositionName(String keyword, Pageable pageable);

    @Query("{\n" +
            "    \"query_string\": {\n" +
            "      \"query\": \"美女多员工福利好\",\n" +
            "      \"default_field\": \"positionAdvantage\"\n" +
            "    }\n" +
            "  }")
    Page<Position> findByPositionAdvantage(String keyword, Pageable pageable);
}
